<p>Because <code>Object</code> implements <code>hashCode</code>, any Java class can be put into a hash structure. However, classes that define
<code>equals(Object)</code> but not <code>hashCode()</code> aren't truly hash-able because instances that are equivalent according to the
<code>equals</code> method can return different hashes.</p>
<h2>Noncompliant Code Example</h2>
<pre>
public class Student {  // no hashCode() method; not hash-able
  // ...

  public boolean equals(Object o) {
    // ...
  }
}

public class School {
  private Map&lt;Student, Integer&gt; studentBody = // okay so far
          new HashTable&lt;Student, Integer&gt;(); // Noncompliant

  // ...
</pre>
<h2>Compliant Solution</h2>
<pre>
public class Student {  // has hashCode() method; hash-able
  // ...

  public boolean equals(Object o) {
    // ...
  }
  public int hashCode() {
    // ...
  }
}

public class School {
  private Map&lt;Student, Integer&gt; studentBody = new HashTable&lt;Student, Integer&gt;();

  // ...
</pre>

